﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using ESOL.Business.Fin;
using ESOL.Common.Entity;

namespace ESOL.WinUI.Finance
{
    public partial class frmMaintainBillingHistory : BaseForm.frmBaseDialogyMaintainForm
    {
        #region vars
        private MstSupplierEntity mSelectedSupplier;

        #endregion

        #region ctors
        public frmMaintainBillingHistory(MstSupplierEntity supplier)
        {
            InitializeComponent();
            mSelectedSupplier = supplier;
        }
        #endregion

        #region functions
        private void BindDataGrid()
        {
            string condition = " AND SAI.BILLING_AMOUNT IS NOT NULL ";
            if (mSelectedSupplier == null || string.IsNullOrEmpty(mSelectedSupplier.SupplierId))
            {
                return;
            }
            condition += " AND SAI.SUPPLIER_ID = '" + mSelectedSupplier.SupplierId + "' ";
            string orderBy = "SAI.AMOUNT_DATE DESC";
            DataTable dt = FinSupplierAccountItemBs.GetByCondition(condition, orderBy, "");
            gvMain.DataSource = dt;
        }

        #endregion

        #region events
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);
            btnSave.Text = "确定";
            ThisActionType = Common.ActionType.View;
            BindDataGrid();
        }
        #endregion
    }
}
